<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Opens a connection to the KADM5 library</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.kadm5-get-principals.html">kadm5_get_principals</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.kadm5-modify-principal.html">kadm5_modify_principal</a></div>
 <div class="up"><a href="ref.kadm5.html">KADM5 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.kadm5-init-with-password" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">kadm5_init_with_password</h1>
  <p class="verinfo">(PECL kadm5 &gt;= 0.2.3)</p><p class="refpurpose"><span class="refname">kadm5_init_with_password</span> &mdash; <span class="dc-title">Opens a connection to the KADM5 library</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.kadm5-init-with-password-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">resource</span> <span class="methodname"><strong>kadm5_init_with_password</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$admin_server</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$realm</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$principal</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$password</code></span>
   )</div>

  <p class="para rdfs-comment">
   Opens a connection with the KADM5 library using the
   <em><code class="parameter">principal</code></em> and the given
   <em><code class="parameter">password</code></em> to obtain initial credentials from the
   <em><code class="parameter">admin_server</code></em>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.kadm5-init-with-password-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">admin_server</code></em></dt>

     <dd>

      <p class="para">
       The server.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">realm</code></em></dt>

     <dd>

      <p class="para">
       Defines the authentication domain for the connection.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">principal</code></em></dt>

     <dd>

      <p class="para">
       The principal.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">password</code></em></dt>

     <dd>

      <p class="para">
       If <em><code class="parameter">password</code></em> is omitted or is <strong><code>NULL</code></strong>, a random
       key will be generated.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.kadm5-init-with-password-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns a KADM5 handle on success 或者在失败时返回 <strong><code>FALSE</code></strong>.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.kadm5-init-with-password-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-584">
    <p><strong>Example #1 KADM5 initialization example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$handle&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">kadm5_init_with_password</span><span style="color: #007700">(</span><span style="color: #DD0000">"afs-1"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"GONICUS.LOCAL"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"admin/admin"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"password"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$attributes&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">KRB5_KDB_REQUIRES_PRE_AUTH&nbsp;</span><span style="color: #007700">|&nbsp;</span><span style="color: #0000BB">KRB5_KDB_DISALLOW_PROXIABLE</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$options&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #0000BB">KADM5_PRINC_EXPIRE_TIME&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">KADM5_POLICY&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"default"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">KADM5_ATTRIBUTES&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$attributes</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">kadm5_create_principal</span><span style="color: #007700">(</span><span style="color: #0000BB">$handle</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"burbach@GONICUS.LOCAL"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"password"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$options</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">kadm5_destroy</span><span style="color: #007700">(</span><span style="color: #0000BB">$handle</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.kadm5-init-with-password-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    Connection should be closed after use with
    <span class="function"><a href="function.kadm5-destroy.html" class="function">kadm5_destroy()</a></span>.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.kadm5-init-with-password-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.kadm5-destroy.html" class="function" rel="rdfs-seeAlso">kadm5_destroy()</a> - Closes the connection to the admin server and releases all related resources</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.kadm5-get-principals.html">kadm5_get_principals</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.kadm5-modify-principal.html">kadm5_modify_principal</a></div>
 <div class="up"><a href="ref.kadm5.html">KADM5 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
